

# This sample code uses the Appium python client
# pip install Appium-Python-Client
# Then you can paste this into a file and simply run with Python

from appium import webdriver

caps = {}
caps["platformName"] = "android"
caps["deviceName"] = "192.168.123.170:6666"
caps["appPackage"] = "com.xqxc.customer"
caps["appActivity"] = "com.xqxc.home_module.ui.activity.MainActivity"
caps["autoGrantPermissions"] = True
caps["skipServerInstallation"] = True
caps["skipDeviceInitialization"] = True

driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
driver.implicitly_wait(10)
el3 = driver.find_element_by_id("com.xqxc.customer:id/iv_search")
el3.click()
el4 = driver.find_element_by_id("com.xqxc.customer:id/et_search")
el4.click()
el4.send_keys("测试")
driver.keyevent("66")
driver.keyevent()

el5 = driver.find_element_by_xpath("//android.support.v7.app.ActionBar.Tab[@content-desc=\"全部\"]/android.widget.TextView")
el5.click()
el6 = driver.find_element_by_xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.support.v4.view.ViewPager/android.view.ViewGroup/android.support.v4.view.ViewPager/android.widget.LinearLayout/android.view.ViewGroup/android.support.v7.widget.RecyclerView/android.widget.RelativeLayout[1]/android.view.ViewGroup/android.widget.TextView[2]")
el6.click()

el1 = driver.find_element_by_xpath("//android.support.v7.app.ActionBar.Tab[@content-desc=\"推荐\"]/android.widget.TextView")
el1.click()
el2 = driver.find_element_by_id("com.xqxc.customer:id/tabMeIv")
el2.click()
el3 = driver.find_element_by_id("com.xqxc.customer:id/phoneNoEt")
el3.send_keys("12500000025")
el4 = driver.find_element_by_id("com.xqxc.customer:id/pwdEt")
el4.send_keys("123456")
el5 = driver.find_element_by_id("com.xqxc.customer:id/login_btn")
el5.click()
el6 = driver.find_element_by_id("com.xqxc.customer:id/settingIbtn")
el6.click()
el7 = driver.find_element_by_xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.Button")
el7.click()
el8 = driver.find_element_by_id("com.xqxc.customer:id/account_pwd_tip")
el8.click()








driver.quit()
